package com.neuedu.api.lang;

/**
 * @author 金山
 * 项目：javase
 * site: https://blog.fulfill.com.cn
 * 描述  、
 * @data 2024/10/228:41
 */
public class Human {

    private String name;  //null
    private Integer age; // null

    public Human() {
    }

    public Human(String name, int age) {
        this.name = name;
        this.age = age;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }



    //大部分情况用于测试
    // @Override
    // public String toString() {
    //     return "Human[ name="+name+"  ,age ="+age+"]";
    // }


    @Override
    public String toString() {
        return "Human{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }


    public static void main(String[] args) {

        Human human = new Human("张三",18);
        Human human2 = new Human("李四",0);

        //打印对象 调用的是 toString
        System.out.println( human);


        Human human1  = new Human();



        System.out.println("human1.getAge() = " + human1.getAge());
        System.out.println("human2.getAge() = " + human2.getAge());


    }
}
